var arr=[1,2,3,4]
var arr1  = new Array()
var obj1 = new Object()
//1.字面量创建对象------------------------------
var stu1 ={ 
    name:"张三",
    age:18,
    say:function()
    {
        console.log("打招呼");
    }
}
var stu11 ={ 
    name:"李四",
    age:19,
    say:function()
    {
        console.log("打招呼");
    }
}
var r ="name"
stu1.say()
console.log(stu1.name);
//2.构造函数 创建对象 模版---------------------
function Student(name) {
    this.name =name;
    this.age;
    this.say = function()
    {
        console.log("你好" +name);
    }
}
var s1 = new Student("张三")
s1.age =18
var s2 = new Student("李四")
s2.age = 20
s2.say()
console.log(s2.name);

//
function Cook ()
{
    this.age
    this.name
    this.cooking=function(foodName)
    {
       console.log("出餐：" + foodName);
       
    }
}
var c1 = new Cook()
c1.age =18
c1.cooking("煎饼果子")
var c2 = new Cook()
c2.age = 30
c2.name ="张三"
c2.cooking("掉渣饼")

for(var c in c2)
{
    console.log(c);
}

// 值类型
var a = 10;
var b = a;
a++;
console.log("a==="+a);
console.log("b===="+b);			// 输出结果：10
// 引用类型
var obj = { a: 10 };
var obj1 = obj;
obj.a++;
console.log("obj==="+obj.a); 		// 输出结果：11
console.log("obj1=="+obj1.a); 		// 输出结果：11

function test(a)
{
    a++
}
var t = 1
test(t)

function test2(newObj)
{
    newObj.a =5
}
obj.a=1  
test2(obj)
console.log(obj.a);
